<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<script type="text/javascript">
	$(document).ready(
			function() {
				//pie chart
				/* var total = [ [ '特优', 5 ], [ '优等', 20 ], [ '甲等', 50 ],
						[ '乙上', 20 ], [ '乙等', 5 ] ]; */
				var total = [['无强制分布',0]];
				if("${rawQualset}".length != 0){
					total = eval("${rawQualset}");
				}
				var chart5 = jQuery.jqplot('chart5', [ total ], {
					title : '强制性分布原始模型',
					seriesDefaults : {
						renderer : jQuery.jqplot.PieRenderer,
						rendererOptions : {
							showDataLabels : true
						}
					},
					legend : {
						show : true,
						location : 'e'
					}
				});

				//cut out pie chart without filling
				var total6 = [['无强制分布',0]];
				if("${actualQualset}".length != 0){
					total6 = eval("${actualQualset}");
				}
				var chart6 = jQuery.jqplot('chart6', [ total6 ], {
					title : '强制性分布现实模型',
					seriesDefaults : {
						renderer : jQuery.jqplot.PieRenderer,
						rendererOptions : {
							fill : false, // Turn off filling of slices.
							showDataLabels : true,
							sliceMargin : 4, // Add a margin to seperate the slices. 
							lineWidth : 2
						// stroke the slices with a little thicker line.
						}
					},

					legend : {
						show : true,
						location : 'e'
					}
				});

			});
</script>
<!-- jQplot SETUP END -->
<div class="grid_4" style="margin-left: 2%; width: 46%">
	<div class="jqPlot" id="chart5" style="width: 100%; height: 220px;"></div>
</div>

<div class="grid_4" style="margin-left: 2%; width: 46%">
	<div class="jqPlot" id="chart6" style="width: 100%; height: 220px;"></div>
</div>

<div class="container_12 clearfix leading">
	<section class="portlet grid_12 leading">

		<header>
			<h2>强制性分布数据</h2>
		</header>

		<section>
			<s:if test="#request.examQualDistSet != null && (#request.examQualDistSet.type.toString().equals('percentage') || #request.examQualDistSet.type.toString().equals('custom_field'))">
			<table class="basic-table">
				<thead>
					<tr>
						<th style="width: 100px">绩等</th>
						<th>分数区间</th>
						<th>原始百分比</th>
						<th>现实百分比</th>
						<th>原始人数分布</th>
						<th>现实人数分布</th>
						<th>差额</th>
					</tr>
				</thead>

				<tbody>
					<s:if
						test="#request.coerceSetPojos == null || #request.coerceSetPojos.size() <= 0">
						<tr>
							<td colspan="7">该部门未设定强制分布</td>
						</tr>
					</s:if>
					<s:else>
						<s:iterator value="#request.coerceSetPojos" var="qualset"
							status="sta">
							<tr>
								<td>${qualset.name}</td>
								<td class="ar"><a href="#">${qualset.scoreStart}-${qualset.scoreEnd}分</a></td>
								<td class="ar"><fmt:formatNumber
										value="${qualset.percentage}" type="percent"></fmt:formatNumber></td>
								<td class="ar"><fmt:formatNumber
										value="${qualset.actualPercentage}" type="percent"></fmt:formatNumber></td>
								<td class="ar">${qualset.number}人</td>
								<td class="ar">${qualset.actualNumber}人</td>
								<td class="ar"><s:if test="#qualset.balanceNumber > 0">
										<p style="color: #3C0; font-weight: bold">+${qualset.balanceNumber}人</p>
									</s:if> <s:elseif test="#qualset.balanceNumber < 0">
										<p style="color: #F00; font-weight: bold">${qualset.balanceNumber}人</p>
									</s:elseif> <s:else>
								&nbsp;
								</s:else></td>

							</tr>
						</s:iterator>
					</s:else>
				</tbody>
			</table>
			</s:if>
			<s:else>
				<p>已设定为不实行强制性分布</p>
			</s:else>
		</section>
	</section>
</div>
<s:if test="#request.accordDistribution == false">
<script type="text/javascript">
	$(document).ready(function(){
		isAccordDist = false;
	});
</script>
</s:if><s:elseif test="#request.accordDistribution == true">
<script type="text/javascript">
	$(document).ready(function(){
		isAccordDist = true;
	});
</script>
</s:elseif>

<script type="text/javascript">
	isAllowGenerateCommit = ${allowGenerateScore};
	isAllowSpecialCommit = ${allowSpecialScore};
	lastAuditer = ${lastAuditer};
	$(document).ready(function(){
		if(isAllowGenerateCommit != null && isAllowGenerateCommit == false){
			$("#g_clk").attr("style","display:none");
		}
		
		if(isAllowSpecialCommit != null && isAllowSpecialCommit == false){
			$("#s_clk").attr("style","display:none");
		}
		if(lastAuditer != null && lastAuditer == true){
			$("#s_text").html("普通提交");
		}
		
	});
	
</script>